@extends('Layout/userbase')

@section('header-js')


	<link rel="stylesheet" type="text/css" href="{{ asset('css/base.css') }}">
	<link rel="stylesheet" type="text/css" href="{{ asset('css/member.css') }}">

	<link rel="stylesheet" type="text/css" href="{{ asset('css/home.css') }}">
	<script type="text/javascript" src="{{ asset('js/js-tab.js') }}"></script>

@endsection


@section('content')
<div class="member-right fr">
<div class="member-head">
    <div class="member-heels fl"><h2>我的订单</h2></div>
</div>
<div class="member-whole clearfix">
    <ul id="H-table" class="H-table">
        <li class="cur" orderStatus="1"><a href="#">待付款<em>({{$notPayCount}})</em></a></li>
        <li orderStatus="2"><a href="#">待发货<em>({{$notSendCount}})</em></a></li>
        <li orderStatus="3"><a href="#">待收货<em>({{$notGetCount}})</em></a></li>
        <li orderStatus="4"><a href="#">交易完成<em>({{$overCount}})</em></a></li>
        <li orderStatus="5"><a href="#">取消的订单<em>({{$cancellCount}})</em></a></li>
    </ul>
</div>
<div class="member-border">
   <div class="member-return H-over">
       <div class="member-cancel clearfix">
		   <p style="color:red">下单后30分钟内未支付，订单将自动取消！！促销商品为5分钟！！！</p>
           <span class="be1">订单信息</span>
           <span class="be2">收货人</span>
           <span class="be2">订单金额</span>
           <span class="be2">订单时间</span>
           <span class="be2">订单状态</span>
           <span class="be2">订单操作</span>
       </div>
       <div class="member-sheet clearfix">
           <ul>
				   @foreach ($notPay as $v)
					 					<li>
                   <div class="member-minute clearfix">
                       <span>{{ $v->create_at }}</span>
                       <span>订单号：<em>{{ $v->o_num }}</em></span>
                       <span class="member-custom">客服电话：<em>010-6544-0986</em></span>
                   </div>
                   <div class="member-circle clearfix">
                       <div class="ci1" style="height:168;width:391;overflow:hidden">
						  @foreach($v->hasManyOrderdetail as $detail)
                           <div class="ci7 clearfix">
                               <span class="gr1"><a href="#"><img src="http://oydt3ttm3.bkt.clouddn.com/{{ $detail->picurl }}" width="60" height="60" title="" about=""></a></span>
                               <span class="gr2"><a href="#">{{ $detail->gname }}</a></span>
                               <span class="gr3">X{{ $detail->buynum }}</span>
                           </div>
						   @endforeach
                       </div>
                       <div class="ci2" >{{ $v->getname }}</div>
                       <div class="ci3">
															   <b>￥{{ $v->total }}</b>
															   <p>网络支付</p>
														   </div>
                       <div class="ci4"><p>{{ $v->create_at }}</p></div>

                       <div class="ci5 ci8">
						   									<p>
															   <form action="{{ route('orderlistpay') }}" method="post">
																   {{ csrf_field() }}
																   <input type="hidden" name="oid" value="{{ $v->id }}">
															   	   <button class="btn" style="width:80px">立即支付</button>
															   </form>
						   						 			</p>
															<p><a href="{{ route('orderdetail', ['oid' => $v->id]) }}">查看详情</a></p>
						   									<p><a href="javascript:;" onclick="cancel(this, {{ $v->id }})">取消订单</a> </p>
					   								</div>
                   </div>
											 </li>
				   			@endforeach
           </ul>
       </div>
   </div>
   <div class="member-return H-over" style="display:none;">
       <div class="member-cancel clearfix">
           <span class="be1">订单信息</span>
           <span class="be2">收货人</span>
           <span class="be2">订单金额</span>
           <span class="be2">订单时间</span>
           <span class="be2">订单状态</span>
           <span class="be2">订单操作</span>
       </div>
       <div class="member-sheet clearfix">
							 <ul>
				 @foreach ($notSend as $v)
									<li>
											 <div class="member-minute clearfix">
													 <span>{{ $v->create_at }}</span>
													 <span>订单号：<em>{{ $v->o_num }}</em></span>
													 <span class="member-custom">客服电话：<em>010-6544-0986</em></span>
											 </div>
											 <div class="member-circle clearfix">
													 <div class="ci1" style="height:168;width:391;overflow:hidden">
						@foreach($v->hasManyOrderdetail as $detail)
															 <div class="ci7 clearfix">
																	 <span class="gr1"><a href="#"><img src="http://oydt3ttm3.bkt.clouddn.com/{{ $detail->picurl }}" width="60" height="60" title="" about=""></a></span>
																	 <span class="gr2"><a href="#">{{ $detail->gname }}</a></span>
																	 <span class="gr3">X{{ $detail->buynum }}</span>
															 </div>
						 @endforeach
													 </div>
													 <div class="ci2" >{{ $v->getname }}</div>
													 <div class="ci3">
															 <b>￥{{ $v->total }}</b>
															 <p>网络支付</p>
														 </div>
													 <div class="ci4"><p>{{ $v->create_at }}</p></div>

													 <div class="ci5 ci8">
															<p><a href="{{ route('orderdetail', ['oid' => $v->id]) }}">查看详情</a></p>
															<p><a href="javascript:;" onclick="alert('哈哈哈哈或！这是假的')">提醒卖家发货</a></p>
													</div>
											 </div>
										 </li>
							@endforeach
							 </ul>
       </div>
   </div>
   <div class="member-return H-over" style="display:none;">
					 <div class="member-cancel clearfix">
							 <span class="be1">订单信息</span>
							 <span class="be2">收货人</span>
							 <span class="be2">订单金额</span>
							 <span class="be2">订单时间</span>
							 <span class="be2">订单状态</span>
							 <span class="be2">订单操作</span>
					 </div>
					 <div class="member-sheet clearfix">
						 <ul>
			 @foreach ($notGet as $v)
								<li>
										 <div class="member-minute clearfix">
												 <span>{{ $v->create_at }}</span>
												 <span>订单号：<em>{{ $v->o_num }}</em></span>
												 <span class="member-custom">客服电话：<em>010-6544-0986</em></span>
										 </div>
										 <div class="member-circle clearfix">
												 <div class="ci1" style="height:168;width:391;overflow:hidden">
					@foreach($v->hasManyOrderdetail as $detail)
														 <div class="ci7 clearfix">
																 <span class="gr1"><a href="#"><img src="http://oydt3ttm3.bkt.clouddn.com/{{ $detail->picurl }}" width="60" height="60" title="" about=""></a></span>
																 <span class="gr2"><a href="#">{{ $detail->gname }}</a></span>
																 <span class="gr3">X{{ $detail->buynum }}</span>
														 </div>
					 @endforeach
												 </div>
												 <div class="ci2" >{{ $v->getname }}</div>
												 <div class="ci3">
														 <b>￥{{ $v->total }}</b>
														 <p>网络支付</p>
													 </div>
												 <div class="ci4"><p>{{ $v->create_at }}</p></div>

												 <div class="ci5 ci8">
													 	<p><a href="javascript:;" onclick="confirmget(this, {{  $v->id  }})">确认收货</a></p>
														<p><a href="{{ route('orderdetail', ['oid' => $v->id]) }}">查看详情</a></p>
														<p><a href="javascript:;" onclick="alert('哈哈哈哈或！这是假的')">查看物流</a></p>

												</div>
										 </div>
									 </li>
						@endforeach
						 </ul>
					 </div>
				 </div>
				 <div class="member-return H-over" style="display:none;">
					<div class="member-cancel clearfix">
							<span class="be1">订单信息</span>
							<span class="be2">收货人</span>
							<span class="be2">订单金额</span>
							<span class="be2">订单时间</span>
							<span class="be2">订单状态</span>
							<span class="be2">订单操作</span>
					</div>
					<div class="member-sheet clearfix">
						<ul>
			@foreach ($over as $v)
							 <li>
										<div class="member-minute clearfix">
												<span>{{ $v->create_at }}</span>
												<span>订单号：<em>{{ $v->o_num }}</em></span>
												<span class="member-custom">客服电话：<em>010-6544-0986</em></span>
										</div>
										<div class="member-circle clearfix">
												<div class="ci1" style="height:168;width:391;overflow:hidden">
				 @foreach($v->hasManyOrderdetail as $detail)
														<div class="ci7 clearfix">
																<span class="gr1"><a href="#"><img src="http://oydt3ttm3.bkt.clouddn.com/{{ $detail->picurl }}" width="60" height="60" title="" about=""></a></span>
																<span class="gr2"><a href="#">{{ $detail->gname }}</a></span>
																<span class="gr3">X{{ $detail->buynum }}</span>
														</div>
					@endforeach
												</div>
												<div class="ci2" >{{ $v->getname }}</div>
												<div class="ci3">
														<b>￥{{ $v->total }}</b>
														<p>网络支付</p>
													</div>
												<div class="ci4"><p>{{ $v->create_at }}</p></div>

												<div class="ci5 ci8">
													 <p><a href="{{ route('orderdetail', ['oid' => $v->id]) }}">订单详情</a></p>
													 <p><a href="javascipt:;" onclick="del(this, {{ $v->id }})">删除订单</a></p>
											 </div>
										</div>
									</li>
					 @endforeach
						</ul>
					</div>
				</div>
   <div class="member-return H-over" style="display:none;">
					 <div class="member-cancel clearfix">
							 <span class="be1">订单信息</span>
							 <span class="be2">收货人</span>
							 <span class="be2">订单金额</span>
							 <span class="be2">订单时间</span>
							 <span class="be2">订单状态</span>
							 <span class="be2">订单操作</span>
					 </div>
					 <div class="member-sheet clearfix">
						 <ul>
			@foreach ($cancell as $v)
							 <li>
										 <div class="member-minute clearfix">
												 <span>{{ $v->create_at }}</span>
												 <span>订单号：<em>{{ $v->o_num }}</em></span>
												 <span class="member-custom">客服电话：<em>010-6544-0986</em></span>
										 </div>
										 <div class="member-circle clearfix">
												 <div class="ci1" style="height:168;width:391;overflow:hidden">
				 @foreach($v->hasManyOrderdetail as $detail)
														 <div class="ci7 clearfix">
																 <span class="gr1"><a href="#"><img src="http://oydt3ttm3.bkt.clouddn.com/{{ $detail->picurl }}" width="60" height="60" title="" about=""></a></span>
																 <span class="gr2"><a href="#">{{ $detail->gname }}</a></span>
																 <span class="gr3">X{{ $detail->buynum }}</span>
														 </div>
					@endforeach
												 </div>
												 <div class="ci2" >{{ $v->getname }}</div>
												 <div class="ci3">
														<b>￥{{ $v->total }}</b>
														<p>网络支付</p>
													</div>
												 <div class="ci4"><p>{{ $v->create_at }}</p></div>

												 <div class="ci5 ci8">
													 <p><a href="{{ route('orderdetail', ['oid' => $v->id]) }}">查看详情</a></p>
													 <p><a href="javascipt:;" onclick="del(this, {{ $v->id }})">删除订单</a></p>
											 </div>
										 </div>
									</li>
					 @endforeach
						 </ul>
					 </div>
				 </div>

</div>
</div>

<!-- 商城快讯 End -->

@endsection


@section('foot-js')

<script>
         $(function(){

             $("#H-table li").each(function(i){
                 $(this).click((function(k){
                     var _index = k;
										 var str = '';
                     return function(){
                         $(this).addClass("cur").siblings().removeClass("cur");
                         $(".H-over").hide();
                         $(".H-over:eq(" + _index + ")").show();

                     }
                 })(i));
             });
             $("#H-table1 li").each(function(i){
                 $(this).click((function(k){
                     var _index = k;
                     return function(){
                         $(this).addClass("cur").siblings().removeClass("cur");
                         $(".H-over1").hide();
                         $(".H-over1:eq(" + _index + ")").show();

                     }
                 })(i));
             });
         });

		 {{-- 取消订单 --}}
		 function cancel(obj, oid) {
			 $.ajax({
				 dataType: 'json',
				 type: 'post',
				 url: "{{ route('ordercancel') }}",
				 data: '_token={{ csrf_token() }}&oid=' + oid,
				 success: function(data) {
					 if (data.status == 200) {
						 alert(data.msg);
						 location.href = 'orderlist';
					 } else {
						 alert(data.msg);
					 }
				 },
			 });
		 }

		 {{-- 删除订单 --}}
		 function del(obj, oid) {
			 $.ajax({
				 dataType: 'json',
				 type: 'post',
				 url: "{{ route('orderdel') }}",
				 data: '_token={{ csrf_token() }}&oid=' + oid,
				 success: function(data) {
					 if (data.status == 200) {
						 alert(data.msg);
						 location.href = 'orderlist';
					 } else {
						 alert(data.msg);
						 location.href = '/Home';
					 }
				 },
			 });
		 }

		 {{--  确认收货 --}}
		 function confirmget(obj, oid) {
			 $.ajax({
				 dataType: 'json',
				 type: 'post',
				 url: "{{ route('confirmget') }}",
				 data: '_token={{ csrf_token() }}&oid=' + oid,
				 success: function(data) {
					 if (data.status == 200) {
						 alert(data.msg);
						 location.href = 'orderlist';
					 } else {
						 alert(data.msg);
						 location.href = '/Home';
					 }
				 },
			 });
		 }
     </script>


@endsection
